<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>完善信息</title>
    <link rel="stylesheet" href="../../libs/node_modules/bootstrap/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="../../style/common.css">
    <link rel="stylesheet" href="../../style/home/article.css">
    <link rel="stylesheet" href="../../style/login/register.css">
    <script src="../../libs/jquery-3.2.1.min.js"></script>
	<script src="../../libs/vue.js"></script>
	<script src="../../jsc/axios.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
    <script src="../../libs/node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
    <script src="../../libs/layer-v3.1.1/layer/layer.js"></script>
    <script src="../../libs/node_modules/echarts/dist/echarts.js"></script>
    <!--<script src="js/system.js"></script>-->
</head>
<body>
<div id="app">
	<!--<header></header>-->
	<!--<nav></nav>-->

	<header-component></header-component>
	<navinner-component></navinner-component>
	<navrow-component></navrow-component>
	<main>
		<div class="content">
			<div class="register-box" style="margin-bottom: 0">
				<form action="" class="register-form" name="content">
					<div class="register-process" style="margin-bottom: 5rem">
						<span>1</span>用户注册
						<hr style="border:none;border-bottom:1px dashed #BFBFBF;height:1px;width: 8.94rem">
						<span class="active">2</span>完善信息
						<hr style="border:none;border-bottom:1px dashed #FE7600;height:1px;width: 8.94rem">
						<span>√</span>注册成功
					</div>
					<div class="register-info-props">
						<div class="register-info-props-title">
							<div class="register-info-props-title-inner">
								<img src="../../static/icons/会员(3).png" alt="">会员类型
							</div>
						</div>
						<div class="register-info-props-name">
							<div class="register-info-props-name-item" :class="checkmenber==2 ?'active':''" data-id="2" @click="menber">业主会员</div>
							<div class="register-info-props-name-item" :class="checkmenber==3 ?'active':''" data-id="3" @click="menber">物业会员</div>
							<div class="register-info-props-name-item" :class="checkmenber==4 ?'active':''" data-id="4" @click="menber">业委会会员</div>
							<div class="register-info-props-name-item" :class="checkmenber==5 ?'active':''" data-id="5" @click="menber">党建会员</div>
							<div class="register-info-props-name-item" :class="checkmenber==6 ?'active':''" data-id="6" @click="menber">政府会员</div>
						</div>
					</div>
					<div class="register-info-props">
						<div class="register-info-props-title">
							<div class="register-info-props-title-inner">
								<img src="../../static/icons/性别.png" alt="">性别
							</div>
						</div>
						<div class="register-info-props-name">
							<div class="register-info-props-name-item" :class="checksex==1 ?'active':''" data-id="1" @click="sex">男</div>
							<div class="register-info-props-name-item" :class="checksex==0 ?'active':''" data-id="0" @click="sex">女</div>
						</div>
					</div>
					<div class="register-input-box">
						<div class="register-input-item">
							<div class="register-input-name">
								<img src="../../static/icons/微信(s).png" alt="">
								微信号
							</div>
							<input type="text" placeholder="请输入您的微信号码" name="wxnumber">
						</div>
					</div>
					<div class="register-input-box">
						<div class="register-input-item">
							<div class="register-input-name">
								<img src="../../static/icons/qq(s).png" alt="">
								QQ号
							</div>
							<input type="text" placeholder="请输入您的QQ号" name="qqnumber">
						</div>
					</div>
					<div class="register-input-box">
						<div class="register-input-item">
							<div class="register-input-name">
								<img src="../../static/icons/钉钉s.png" alt="">
								钉钉号
							</div>
							<input type="text" placeholder="请输入钉钉号" name="ddnumber">
						</div>
					</div>
					<div class="register-input-box">
						<div class="register-input-item">
							<div class="register-input-name">
								<img src="../../static/icons/邮箱s.png" alt="">
								电子邮箱
							</div>
							<input type="email" placeholder="请输入您的邮箱" name="email">
						</div>
					</div>
					<div class="register-input-box" style="padding-top: 1rem">
						<div class="register-btn" @click="register">注册</div>
					</div>

				</form>
			</div>
		</div>
	</main>
	<!--<footer class="footer">-->
	<!--</footer>-->
	<footer-component></footer-component>
</div>
<script src="../../jsc/common.js"></script>
<script src="../../jsc/component.js"></script>
<script>
    // (function () {
	//     $("header").load("../../views/common/header_common.html");
	//     $("nav").load("../../views/common/nav_inner.html");
	//     $("footer").load("../../views/common/footer.html");
	// })();
    function register() {
        window.location.href = 'register-success.html';
    }

	new Vue({
		el:"#app",
		data:{
			checkmenber:2,
			checksex:1
		},
		mounted(){
			var _th = this;
		},
		filters:{

		},
		methods:{
			menber:function (e) {
				this.checkmenber = e.target.dataset.id
			},
			sex:function (e) {
				this.checksex = e.target.dataset.id
			},
			register:function(e){
				var formdata = new FormData(document.forms.namedItem("content"));

				var account = JSON.parse(localStorage.getItem('form'));
				var that = this;

				var form = new FormData();
				form.append('username',account.name);
				form.append('mobile',account.mobile);
				form.append('password',account.pwd);
				form.append('group',that.checkmenber);
				form.append('gender',that.checksex);
				form.append('qq',formdata.get('qqnumber'));
				form.append('wechat',formdata.get('wxnumber'));
				form.append('email',formdata.get('email'));
				form.append('dingding',formdata.get('ddnumber'));
				axios.post(sysurl+'user/register',form).then(res=>{
					console.log(res);
					if (res.data.code==1){
						layer.msg('注册成功');
						setCookie('token',res.data.data.userinfo.token);
						setCookie('user_id',res.data.data.userinfo.id);
						localStorage.clear();
						location.href='register-success.html?type=user'
					} else{
						layer.msg(res.data.msg)
					}
				})
			}

		}
	})
</script>
</body>
</html>
